package com.oscarmovie.model;

public class Mpac {
	private int id;
	private Movie movie;
	private Person person;
	private Award award;
	private Calendar calendar;
	private int type;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Movie getMovie() {
		return movie;
	}

	public void setMovie(Movie movie) {
		this.movie = movie;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public Award getAward() {
		return award;
	}

	public void setAward(Award award) {
		this.award = award;
	}

	public Calendar getCalendar() {
		return calendar;
	}

	public void setCalendar(Calendar calendar) {
		this.calendar = calendar;
	}

	public int getType() {
		return type;
	}
	public String getTypeName(){
		return type==1?"提名":"获奖";
	}
	public void setType(int type) {
		this.type = type;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((award == null) ? 0 : award.hashCode());
		result = prime * result
				+ ((calendar == null) ? 0 : calendar.hashCode());
		result = prime * result + ((movie == null) ? 0 : movie.hashCode());
		result = prime * result + ((person == null) ? 0 : person.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Mpac other = (Mpac) obj;
		if (award == null) {
			if (other.award != null)
				return false;
		} else if (!award.equals(other.award))
			return false;
		if (calendar == null) {
			if (other.calendar != null)
				return false;
		} else if (!calendar.equals(other.calendar))
			return false;
		if (movie == null) {
			if (other.movie != null)
				return false;
		} else if (!movie.equals(other.movie))
			return false;
		if (person == null) {
			if (other.person != null)
				return false;
		} else if (!person.equals(other.person))
			return false;
		return true;
	}

//	public int hashCode() {
//		int a = movie == null ? 1000000 : movie.getId() * 1000000;
//		int b = person == null ? 10000 : person.getId() * 10000;
//		int c = award == null ? 100 : award.getId() * 100;
//		int d = calendar == null ? 1 : calendar.getId() * 1;
//		int code = a + b + c + d;
//		return code;
//	}
//
//	public boolean equals(Object object) {
//		boolean t = false;
//		if (object != null) {
//			Mpac mpac = (Mpac) object;
//			boolean a = mpac.getMovie().getId() == this.getMovie().getId();
//			boolean b = mpac.getPerson()==null?
//					(this.getPerson()==null?true:false)
//					:(mpac.getPerson().getId() == this.getPerson().getId());
//			boolean c = mpac.getAward().getId() == this.getAward().getId();
//			boolean d = mpac.getCalendar().getId() == this.getCalendar().getId();
//			
//			t = a && b && c && d;
//		}
//		return t;
//	}
	
	

}
